<script setup>
import Header from '@/components/Header.vue';
import { ref } from 'vue';
import { useRouter } from 'vue-router';




let username = ref('admin@zattest.com');
let password = ref('111111');
let router = useRouter();


let handleLogin = () => {
  if (username.value === 'admin@zattest.com' && password.value === '111111') {
    router.push('/MyCredentials');
    localStorage.setItem('username', 'admin@zattest.com');
    localStorage.setItem('password', '111111');
  } else {
    alert('请输入正确的账号密码');
  }

}


</script>

<template>
  <Header></Header>
  <div class="content">
    <div class="login-box">
      <div class="login-box-title">
        <p>Log In</p>
      </div>
      <div class="login-box-input">
        <img src="../../assets/img/xinxi.svg" alt="">
        <input type="text" placeholder="用户名" v-model="username" />
      </div>
      <div class="login-box-inputx">
        <img src="../../assets/img/mima.svg" alt="">
        <input type="password" placeholder="密码" v-model="password" />
      </div>
      <button @click="handleLogin">Log In</button>
      <div class="login-box-bottom">
        <RouterLink to="/ResetPassword">Forgot/Reset Password?</RouterLink>
        <RouterLink to="/SignUp">Sign Up</RouterLink>
      </div>
    </div>
  </div>
</template>

<style scoped>
.content {
  background-color: #FFE0E0;
  width: 100%;
  height: 1003px;
  display: flex;
  justify-content: center;
  align-items: center;

  .login-box {
    width: 546px;
    height: 426px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;

    .login-box-title p {
      font-weight: 700;
      font-size: 28px;
      color: #0F094C;
      line-height: 100px;
    }

    .login-box-input {
      border: 1px solid #EC535B;
      border-radius: 6px;
      width: 411px;
      height: 44px;
      display: flex;

      img {
        margin: 0 10px;
        width: 21px;
      }

      input {
        width: 100%;
        border: none;
        outline: none;
        background: transparent;
      }
    }

    .login-box-inputx {
      border: 1px solid #DCDCDC;
      border-radius: 6px;
      width: 411px;
      height: 44px;
      display: flex;
      margin-top: 20px;
      margin-bottom: 30px;

      img {
        margin: 0 10px;
        width: 21px;
      }

      input {
        width: 100%;
        border: none;
        outline: none;
        background: transparent;
      }
    }

    button {
      width: 411px;
      height: 60px;
      border-radius: 8px;
      border: none;
      background-color: #EB4648;
      color: #FFFFFF;
      margin-bottom: 40px;
      cursor: pointer;
    }

    .login-box-bottom {
      display: flex;
      width: 411px;
      justify-content: space-between;

    }
  }
}
</style>